Skip to content

feat: add Rust framework support#947

Draft
sarahxsanders wants to merge 1 commit into
mainfrom
posthog-code/rust-framework-support
Draft

feat: add Rust framework support#947
sarahxsanders wants to merge 1 commit into
mainfrom
posthog-code/rust-framework-support

Conversation

@sarahxsanders

@sarahxsanders sarahxsanders commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Related PRs:

Adds Rust as a supported framework, following the backend-framework pattern:

  • Integration.rust enum entry in the frameworks block, before the language fallbacks
  • RUST_AGENT_CONFIG in src/frameworks/rust/ — claims a Cargo.toml with a [package] section; a workspace-root-only manifest ([workspace], no [package]) falls through, and the registry-driven agentic monorepo scan finds the nested crates. Gathers async-runtime presence (tokio/async-std/smol) as agent context to steer between posthog-rs's default async client and the blocking one (--no-default-features). Installs via cargo add posthog-rs.
  • cargoPackageManager helper + FRAMEWORK_REGISTRY entry
  • bash-fence allowlist for cargo: add|remove|build|check|fmt|clippy|metadata|tree|fetch; cargo run/test stay denied (arbitrary code execution) and install/publish stay denied (outward-facing). The pre-existing pinned cargo run deny assertion keeps its verdict but its reason comment changes from "no rust framework" to "arbitrary code execution".
  • Pins framework: rust on a new integration-rust entry in the variant-resolution contract test, matching the context-mill PR above
  • Prompt context reminds the agent that posthog-rs capture is fire-and-forget and flush()/shutdown() must run before exit

Why: the wizard docs page lists Rust as "Coming soon"; instead of removing the label (posthog.com#18797), we're making the wizard actually support it.

Verification: pnpm build ✅, pnpm test ✅ (1548 tests, incl. new rust detect + cargo fence tests), pnpm fix


Created with PostHog Code

@github-actions

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci basic-integration
  • /wizard-ci mcp-analytics
  • /wizard-ci revenue

Test an individual app:

  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
Show more apps
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci revenue/stripe

Results will be posted here when complete.

@sarahxsanders
sarahxsanders force-pushed the posthog-code/elixir-framework-support branch from 5bc160d to f14d962 Compare July 22, 2026 20:41
@sarahxsanders
sarahxsanders force-pushed the posthog-code/rust-framework-support branch from 700cbba to 6cad9a7 Compare July 22, 2026 20:41
@sarahxsanders
sarahxsanders changed the base branch from posthog-code/elixir-framework-support to main July 22, 2026 20:42
Adds Rust as a supported framework, stacked on the Elixir framework PR:

- Integration.rust enum entry in the frameworks block, before the language fallbacks
- RUST_AGENT_CONFIG in src/frameworks/rust/ — claims a Cargo.toml with a [package] section (workspace-root-only manifests fall through; the agentic monorepo scan finds nested crates), gathers async-runtime presence (tokio/async-std/smol) to steer the agent between the default async client and the blocking one, installs via cargo add posthog-rs
- cargoPackageManager helper + FRAMEWORK_REGISTRY entry
- bash-fence allowlist for cargo: add/remove/build/check/fmt/clippy/metadata/tree/fetch; run/test stay denied (arbitrary code execution) and install/publish stay denied (outward-facing); the pinned cargo run assertion's reason changes from "no rust framework" to "arbitrary code execution"
- Pins framework: rust on a new integration-rust entry in the variant-resolution contract test, matching context-mill PR #269 which must release before this merges
- Marks Cargo.toml as a real framework target in the agentic manifest comment

Generated-By: PostHog Code
Task-Id: 9c949855-7611-48f2-b8b5-7aa4112543e5
@sarahxsanders
sarahxsanders force-pushed the posthog-code/rust-framework-support branch from 6cad9a7 to ff7610d Compare July 22, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant